Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@aws-cdk/assets
Advanced tools
Assets are local files or directories which are needed by a CDK app. A common example is a directory which contains the handler code for a Lambda function, but assets can represent any artifact that is needed for the app's operation.
When deploying a CDK app that includes constructs with assets, the CDK toolkit will first upload all the assets to S3, and only then deploy the stacks. The S3 locations of the uploaded assets will be passed in as CloudFormation Parameters to the relevant stacks.
The following JavaScript example defines an directory asset which is archived as a .zip file and uploaded to S3 during deployment.
Example of a ZipDirectoryAsset
The following JavaScript example defines a file asset, which is uploaded as-is to an S3 bucket during deployment.
Asset
constructs expose the following deploy-time attributes:
s3BucketName
- the name of the assets S3 bucket.s3ObjectKey
- the S3 object key of the asset file (whether it's a file or a zip archive)s3Url
- the S3 URL of the asset (i.e. https://s3.us-east-1.amazonaws.com/mybucket/mykey.zip)In the following example, the various asset attributes are exported as stack outputs:
Example of referencing an asset
IAM roles, users or groups which need to be able to read assets in runtime will should be
granted IAM permissions. To do that use the asset.grantRead(principal)
method:
The following examples grants an IAM group read permissions on an asset:
Example of granting read access to an asset
When an asset is defined in a construct, a construct metadata entry
aws:cdk:asset
is emitted with instructions on where to find the asset and what
type of packaging to perform (zip
or file
). Furthermore, the synthesized
CloudFormation template will also include two CloudFormation parameters: one for
the asset's bucket and one for the asset S3 key. Those parameters are used to
reference the deploy-time values of the asset (using { Ref: "Param" }
).
Then, when the stack is deployed, the toolkit will package the asset (i.e. zip the directory), calculate an MD5 hash of the contents and will render an S3 key for this asset within the toolkit's asset store. If the file doesn't exist in the asset store, it is uploaded during deployment.
The toolkit's asset store is an S3 bucket created by the toolkit for each environment the toolkit operates in (environment = account + region).
Now, when the toolkit deploys the stack, it will set the relevant CloudFormation Parameters to point to the actual bucket and key for each asset.
NOTE: This section is relevant for authors of AWS Resource Constructs.
In certain situations, it is desirable for tools to be able to know that a certain CloudFormation resource is using a local asset. For example, SAM CLI can be used to invoke AWS Lambda functions locally for debugging purposes.
To enable such use cases, external tools will consult a set of metadata entries on AWS CloudFormation resources:
aws:asset:path
points to the local path of the asset.aws:asset:property
is the name of the resource property where the asset is usedUsing these two metadata entries, tools will be able to identify that assets are used by a certain resource, and enable advanced local experiences.
To add these metadata entries to a resource, use the
asset.addResourceMetadata(resource, property)
method.
See https://github.com/awslabs/aws-cdk/issues/1432 for more details
0.22.0 (2019-01-10)
This is a major release with multiple breaking changes in the core layers. Please consult the breaking changes section below for details.
We are focusing these days on finalizing the common patterns and APIs of the CDK framework and the AWS Construct Library, which is why you are seeing all these breaking changes. Expect a few more releases with changes of that nature as we stabilize these APIs, so you might want to hold off with upgrading. We will communicate when this foundational work is complete.
export()
and import()
to share constructs between stacks, you can stop doing that, instead of FooImportProps
accept an IFoo
directly on the consuming stack, and use that object as usual.ArnUtils.fromComponents()
and ArnUtils.parse()
have been moved onto Stack
.AWS::AccountId
etc) are now also accessible via Stack
, as stack.accountId
etc.Fn
class (e.g. Fn.join(...)
instead of new FnJoin(...).toString()
)resolve()
has been moved to this.node.resolve()
.CloudFormationJSON.stringify()
has been moved to this.node.stringifyJson()
. validate()
now should be protected
.cloudformation.XxxResource
classes have been removed. Use the CfnXxx
classes instead.CfnXxx
resource attributes that represented a list of strings are now typed as string[]
s (via #1144). Attributes that represent strings, are still typed as string
(#712) and all other attribute types are represented as cdk.Token
.route53.TXTRecord
class was renamed to route53.TxtRecord
.zone
when created (not assuming zone is the parent construct).lambda.FunctionRef
to lambda.Function
.XxxRef
abstract classes are now IXxx
interfacesXxxRefProps
are now XxxImportProps
XxxRef.import(...)
are now Xxx.import(...)
accept XxxImportProps
and return IXxx
export(): XxxImportProps
is now defined in IXxx
and implemented by imported resourcesFAQs
This module is deprecated. All types are now available under the core module
The npm package @aws-cdk/assets receives a total of 19,691 weekly downloads. As such, @aws-cdk/assets popularity was classified as popular.
We found that @aws-cdk/assets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.